import api from '@/http/index'

/* 列表 */
export const getTablesList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/User/GetGridJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 获取公司角色id */
export const getRole = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ClientsData/GetRoleSelectJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 新建 */
export const addTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/User/SubmitForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 根据ID查询详细信息 */
export const getItemInfo = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/User/GetFormJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 用户启用 */
export const setEnable = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/User/EnabledAccount', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 用户停用 */
export const setDisabled = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/User/DisabledAccount', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 删除 */
export const dleTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/User/DeleteAccount', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};